package io.xccit.race.controller;

import io.xccit.common.core.controller.BaseController;
import io.xccit.common.core.domain.AjaxResult;
import io.xccit.race.service.IDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 数据大屏Controller
 * 
 * @author ywx
 * @date 2025-10-10
 */
@RestController
@RequestMapping("/race/dashboard")
public class DashboardController extends BaseController {

    @Autowired
    private IDashboardService dashboardService;

    /**
     * 获取统计数据
     */
    @GetMapping("/statistics")
    public AjaxResult getStatistics() {
        Map<String, Object> statistics = dashboardService.getStatistics();
        return AjaxResult.success(statistics);
    }

    /**
     * 获取竞赛类型分布
     */
    @GetMapping("/competitionTypeDistribution")
    public AjaxResult getCompetitionTypeDistribution() {
        Map<String, Object> data = dashboardService.getCompetitionTypeDistribution();
        return AjaxResult.success(data);
    }

    /**
     * 获取高校地区分布
     */
    @GetMapping("/universityRegionDistribution")
    public AjaxResult getUniversityRegionDistribution() {
        Map<String, Object> data = dashboardService.getUniversityRegionDistribution();
        return AjaxResult.success(data);
    }

    /**
     * 获取竞赛时间分布
     */
    @GetMapping("/competitionTimeDistribution")
    public AjaxResult getCompetitionTimeDistribution() {
        Map<String, Object> data = dashboardService.getCompetitionTimeDistribution();
        return AjaxResult.success(data);
    }

    /**
     * 获取全国竞赛分布
     */
    @GetMapping("/nationalCompetitionDistribution")
    public AjaxResult getNationalCompetitionDistribution() {
        Map<String, Object> data = dashboardService.getNationalCompetitionDistribution();
        return AjaxResult.success(data);
    }

    /**
     * 获取参赛高校学生区域分布
     */
    @GetMapping("/studentRegionDistribution")
    public AjaxResult getStudentRegionDistribution() {
        Map<String, Object> data = dashboardService.getStudentRegionDistribution();
        return AjaxResult.success(data);
    }
}
